
import fetch from '@/utils/fetch'

const CategoryApi = {
  getCategoryPid (pid) {
    return fetch({
      url: '/api/mallCategory/list?pid=' + pid,
      method: 'get'
    })
  },
  getPageList (params) {
    return fetch({
      url: '/api/category/page',
      method: 'get',
      params: params
    })
  },
  getGroupList (params) {
    return fetch({
      url: '/api/spec/group/page',
      method: 'get',
      params: params
    })
  },
  getDetail (id) {
    return fetch({
      url: '/api/mallCategory/' + id,
      method: 'get'
    })
  },
  add (data) {
    return fetch({
      url: '/api/category/add',
      method: 'post',
      data: data
    })
  },
  update (id, data) {
    return fetch({
      url: '/api/category/' + id,
      method: 'put',
      data: data
    })
  },
  del (data) {
    return fetch({
      url: '/api/category/' + data,
      method: 'delete',
      data: data
    })
  },
  addzi (data) {
    console.log(data)
    return fetch({
      url: '/api/mallCategory/addSubclass',
      method: 'post',
      data: data
    })
  }
}
export default CategoryApi
